const {Configuration} = require('webpack')
const commonConfig = require('./webpack.common')
const {merge} = require('webpack-merge')
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
/**
 * @type Configuration
 */
module.exports = merge(commonConfig, {
    mode: 'production',
    plugins: [
        // 提取css到link外链
        new MiniCssExtractPlugin({
            filename: '[name]-[contenthash:8].css',
            chunkFilename: '[id].css'
        })
    ],
    // optimization: {
    //     splitChunks: {
    //         chunks: 'all',
    //         cacheGroups: {
    //             vendors: {
    //                 name: 'vendors',
    //                 minSize: 0,
    //                 test: /node_modules/,
    //                 priority: -10
    //             },
    //             commons: {
    //                 name: 'commons',
    //                 minChunks: 2,
    //                 priority: -20
    //             }
    //         }
    //     }
    // }
})